﻿@model Auction_Intranet.Models.UserNotificationsModel

    @Html.ActionLink(" ", "Index", "Dashboard", null, new { @class = "logo", @title = "Home" })
    <ul>
        <li class="invitations">
            <span class="invitations-count"><span class="invitations-text">Invitations</span>
                @if (Model.numberOfInvitations != 0)
                {
                    <span class="icon-number rounded-corners header-icon-number">@Model.numberOfInvitations</span>
                }
            </span>
            <ul class="invitations-list">
                @{ int i = -1; }
                @foreach (var item in Model.userInvitations)
                {
                    i++;
                    if (i == 0)
                    {
                        <li class="no-top-border"><span>@FileHelper.Truncate(item.Group.Name, 15)</span> @Html.ActionLink("accept", "AcceptInvitation", new { id = item.Id }, new { @class = "accept input-button" }) @Html.ActionLink("decline", "DeclineInvitation", new { id = item.Id }, new { onclick = "return confirm('Are you sure you wish decline invitation to the group ?');", @class = "input-button" })</li>                        
                    }
                    else
                    {
                        <li><span>@FileHelper.Truncate(item.Group.Name, 15)</span> @Html.ActionLink("accept", "AcceptInvitation", new { id = item.Id }, new { @class = "accept input-button" }) @Html.ActionLink("decline", "DeclineInvitation", new { id = item.Id }, new { onclick = "return confirm('Are you sure you wish decline invitation to the group ?');", @class = "input-button" })</li>
                    }
                }
                @if (Model.userInvitations.Count() == 0)
                {
                    <li>No pending invitations</li>
                }
                else
                { 
                    <li class="see-all">@Html.ActionLink("See All", "Invitations", "Action")</li>
                }
            </ul>
        </li>
        <li class="separator">|</li>
        <li class="notifications">                                           
            <span class="notifications-count"><span class="notifications-text">Notifications</span>
                @if (Model.numberOfNotifications != 0)
                {
                    <span class="icon-number rounded-corners header-icon-number">@Model.numberOfNotifications</span>
                }
            </span>
            <ul class="notifications-list">
                @{ int l = -1; string status = ""; }
                @foreach (var item in Model.userNotifications)
                {
                    if (item.Accepted == true)
                    {
                        status = "accepted";
                    }
                    else 
                    {
                        status = "declined";
                    }                    
                    l++;
                    if (l == 0)
                    {
                        <li class="@status no-top-border">@item.Message for @item.Bid.Group.Name</li>  
                    }
                    else
                    {
                        <li class="@status">@item.Message for @item.Bid.Group.Name</li>
                    }
                }
                @if (Model.userNotifications.Count() == 0)
                {
                    <li>No notifications</li>
                }
                else
                { 
                    <li class="see-all">@Html.ActionLink("See All", "Notifications", "Action")</li>
                }
            </ul>        
        </li>
        <li class="separator help-separator">|</li>
        <li class="help">@Html.ActionLink("Help", "Help", "Action")</li>
        <li class="separator logout-separator">|</li>
        <li class="logout">@Html.ActionLink("Log Out", "Index", "Logout", null, new { @title = "Log out"})</li>
    </ul>